ValidateActivationCode

SoftwareShield ClientProtector COM Component > ClientProtector (SSCProtector) Reference > ValidateActivationCode

## ValidateActivationCode

The ValidateActivationCode function checks that the input Activation Code is valid against the currently loaded license - but it does not actually input (activate) the Activation Code. Call this function to check that a given Activation Code is valid against the license without actually activating it.

###### Syntax

HRESULT ValidateActivationCode ( BSTR ActivationCode, VARIANT_BOOL * IsValid, long * return_code );

###### Parameters

ActivationCode

[IN] Wide string value identifying the Activation Code you wish to verify against the currently loaded license.

IsValid

[OUT] This is (a pointer to) a boolean value that returns with the validity of the Activation Code input in the ActivationCode parameter. Will return holding true if the code is valid, false otherwise. More detailed information can be gained from the return_code parameter.

return_code

[OUT] This is (a pointer to) a numeric value that returns with a RETURNCODE that identifies the outcome of the validation. (See remarks section below for details.)

###### Remarks

Note: This function is illustrated in the SoftwareShield Flowcharts - (see flow chart #3).

Call ValidateActivationCode when you need to check if an Activation Code is valid against the currently loaded license without actually inputting (activating) it. This function simply checks that the code is valid - it does not make any changes to the state of the license files whatsoever on the users machine, regardless of if the code is valid or not.

The IsValid parameter returns holding true if the Activation Code was validated successfully, false otherwise.

The return_code parameter returns with a RETURNCODE that identifies the outcome of the operation as follows:

If the license has not been initialized successfully with a call to StartUp, the function will return with return_code holding FALSE_LICENSE_NOT_INITIALIZED.

It will return holding FALSE_CODE_INVALID_FORMAT if the codes format is incorrect. (The code must correspond exactly to the format outlined for Activation Codes.)

It will return holding FALSE_CODE_INVALID_BAD_ID if the code is incorrect or more specifically does not refer to a valid ID in the currently loaded license.

It will return holding FALSE_CODE_INVALID_BAD_FP if the FingerPrint embedded inside the Activation Code does not match the computed FingerPrint of the host machine.

It will return holding FALSE_CODE_INVALID_EXPIRED_SL if the Shelf-Life inside the Activation Code has already elapsed.

It will return holding FALSE_CLOCK_TURNED_BACK if the Activation Code contains a Shelf-Life, but the ClientProtector has detected that the system clock has been turned back.

It will return holding FALSE_CODE_INVALID_SINGLE_USE if the code was valid, but its corresponding Authorization Definition was marked as Single-Use, and the code had already been used in the currently loaded license.

If all of the above checks pass - it will return holding TRUE_CODE_VALID.

###### Return Value

As with all COM function calls they return an HRESULT. HRESULT is a data type that is a 32-bit error or warning code. Check your compilers documentation for information on interpreting the HRESULT value.

###### Function Information

Exposed By Interface: | "ISSCProtector"
Exposed In COM Server Binaries: | "SSCProt.dll" and "SSCProtD.dll"